﻿<!--#include file="../inc/easp/easp.asp"-->
<!--#include file="../inc/conn1.asp"-->
<!--#include file="../inc/checklogin.asp"-->
<!--#include file="../inc/page.asp"-->
<% CheckLogin("../index.asp") %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Holiday Control</title>
<link rel="stylesheet" type="text/css" href="../css/theme.css" />
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<script type="text/javascript">
	var StyleFile = "theme" + document.cookie.charAt(6) + ".css";
	document.writeln('<link rel="stylesheet" type="text/css" href="../css/' + StyleFile + '">');
</script>
<script language="javascript" type="text/javascript">
	function deletexml(cid,gid,cou)
	{
		if(confirm("Are you sure?"))
		{
			top.location.href = "del.asp?y_id=" + cid + "&g_id=" + gid + "&Country=" + cou;
		}
		else
		{
			
		}
	}
</script>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie-sucks.css" />
<![endif]-->
</head>
<body>
<div id="container">
	<div id="header">
    <div id="divAccount" style="float:right;">
        <a href="../user/account.asp" style="color:white">Account</a>&nbsp;&nbsp;&nbsp;&nbsp;
        <a href="../inc/logout.asp" style="color:white">Logout</a>
      </div>
		<h2>Holiday Control</h2>
		<div id="topmenu">
			<ul>
				<li><a href="../main.asp">Home</a></li>
				<%
				   If Session("Authority")="0" Then 
				     Easp.wc "<li><a href='../Country/index.asp'>Country</a></li>"
				   End if
				%>
				<li class="current"><a href="#">Holiday</a></li>
				<li><a href="../Times/index.asp">Times</a></li>
				<li><a href="../wallboard/index.asp">WallBoard</a></li>
				<%
				   If Session("Authority")="0" Then 
				       Response.Write("<li><a href='../user/index.asp'>User</a></li>")
				   End if
				%>
				<li><% If Session("Passed")=true Then %><a href="../inc/logout.asp">Logout</a><% End If %></li>
			</ul>
		</div>
	</div>
	<div id="top-panel">
		<div id="panel">
			<ul>
				<% 
				  If Session("Authority")="0" Then
				    Easp.wc "<li><a href='../country/add.asp?page=country' class='add'>Add Country</a></li>"
				  end if
				%>
			</ul>
		</div>
	</div>
	<div id="wrapper">
		<div id="content">
			<form id="form" action="Holiday.asp" method="post">
				<div id="box">
					<h3>Holiday Control</h3>						
					<table width="100%" style="text-align: center;">
						<thead>
							<tr>
								<th width="80" class="a-center"><a href="#">NO.</a></th>
								<th width="160"><a href="#">Country</a></th>								
								<th width="360"><a href="#">Operate</a></th>
								<th class="a-center"><a href='#'>Details</a></th>
							</tr>
						</thead>
						<tbody>
						<%	
						  dim sql1,sql2
						  sql1 = "SELECT Country.y_id, Country.g_id, Country.HolidayNum, Country.CountryName, Country.HolidayFile, Country.TimesFile FROM Country INNER JOIN [Group] ON Country.g_id = Group.ID ORDER BY Country.y_id"
						  sql2 = "SELECT Country.y_id, Country.g_id, Country.HolidayNum, Country.CountryName, Country.HolidayFile, Country.TimesFile FROM Country INNER JOIN UserCountry ON Country.y_id = UserCountry.CountryID WHERE (([UserCountry].[UserID]=" & Session("ID") & ")) ORDER BY Country.y_id"
											
						  dim rs1
						  If Session("Authority")="0" Then						  	
						  	set rs1 = Easp.db.GetRecordBySql(sql1)
						  Else						  
						  	set rs1 = Easp.db.GetRecordBySql(sql2)
						  End If
						  
						  If Not Easp.IsN(rs1) Then
						  	dim mm
						    Set mm = new Cls_PageView
						    with mm
						      .PageSize = 10
						      .GetConn = Conn						      
	                If Session("Authority")="0" Then
	                	.GetTbName = "Country INNER JOIN [Group] ON Country.g_id = Group.ID"
	                  .GetField = "Country.y_id, Country.g_id, Country.HolidayNum, Country.CountryName, Country.HolidayFile, Country.TimesFile"
	                	.GetWhere = ""
	                Else
	                	.GetTbName = "Country INNER JOIN UserCountry ON Country.y_id = UserCountry.CountryID"
	                  .GetField = "Country.y_id, Country.g_id, Country.HolidayNum, Country.CountryName, Country.HolidayFile, Country.TimesFile"
	                  .GetWhere = "(([UserCountry].[UserID]=" & Session("ID") & "))"
	                End If
	                .GetKey = "Country.y_id"
	                .GetOrder = "Country.y_id"
						    end with
						  
						    dim rs,iPageIndex, iCount
						    set rs = mm.GetRs()						   
						    iPageIndex = CInt(Easp.Get("Page"))
						    if iPageIndex = 0 then iPageIndex = 1
						    iCount = 1
						    If Not Easp.IsN(rs) Then
						  	  '找到记录
						  	  While not rs.eof
						  	    Easp.wc "<tr>"						  	    
						  	    Easp.wc "<td class=""a-center"">" & (iCount + (iPageIndex - 1) * 10) & "</td>"						  	    
						  	    Easp.wc "<td>" & rs("CountryName") & "</td>"
						  	    
						  	    dim HolidayFile
						  	    HolidayFile = Trim(rs("HolidayFile"))			
						  	    if Session("Authority") = "1" Then
						  	    	Easp.wc "<td class='a-center'>Not Enough Authority!</td>"
						  	    else						  	    	
						  	      If HolidayFile = "" Then
						  	    	  Easp.wc "<td class='a-center'><a href='main.asp?y_id=" & rs("y_id") & "&g_id=" & rs("g_id") & "&holinum=" & rs("HolidayNum") & "&op=add'>Add</a></td>"
						  	      Else
						  	    	  Easp.wc "<td class='a-center'><a href='main.asp?y_id=" & rs("y_id") & "&g_id=" & rs("g_id") & "&holinum=" & rs("HolidayNum") & "&op=modify'>Modify</a>&nbsp;&nbsp;"
						  	    	  Easp.wc "<a href=""javascript:deletexml(" & rs("y_id") & "," & rs("g_id") & ",'" & rs("CountryName") & "')"">Delete</a></td>"
						  	      End If	
								End If
								
								if HolidayFile = "" Then
						  	    	Easp.wc "<td class='a-center'>No content</td>"
						  	    Else
						  	        Easp.wc "<td class='a-center'><a href='details.asp?y_id=" & rs("y_id") & "&g_id=" & rs("g_id") & "&holinum=" & rs("HolidayNum") & "'>Details</a></td>"	
								End if
						  	    Easp.wc "</tr>"
						  	    
						  	    iCount = iCount + 1
						  	    rs.MoveNext()
						  	  Wend
						    Else
						  	'没有找到记录
						    End If	
						  End If					  					  
						%>
						</tbody>
					</table>
					<div id="pager">
						<%
						  If Not Easp.IsN(rs1) Then						    
						    Easp.db.C(rs)						
						    Easp.wc(mm.ShowPage())'显示分页 
						  End If
						  Easp.db.C(rs1)
						%>
					</div>
				</div>
			</form>
		</div>
	</div>
	<!--#include file="../inc/footer.asp" -->
</div>
</body>
</html>
